layui.use('layer', function(){
    var layer = layui.layer;


    let oButton = document.querySelector('.button input')
    let oPassword = document.querySelector('.password input')
    let oPhone = document.querySelector('.phone_p1 input')
    oButton.addEventListener("click",async()=>{
        let res = await axios({
            url:'http://123.57.227.10:8080/login',
            method: 'get',
            params: {
              password: oPassword.value,
              username: oPhone.value
            }
        })
        console.log(res);
        if(res.data.code == -2){
                layer.alert("用户名不能为空")
        }else if(res.data.code == -1){
            layer.alert("密码不能为空")
        }else if(res.data.code == 1){
            layer.msg("注册成功，正在跳转主页...")
            setTimeout(()=>{
                location.href = `../index.html`
            },1500)
        }else{
            layer.alert("手机号码或密码错误，请核对后重试")
        }
    })






    
  });